<template>
	<div class="main-box">
		<el-container>
			<el-header>
				<div class="fl heightMax header-left">
					<img class="heightMax" :src="imgLeft" alt="" />
					<div class="titleDes">
						<!-- 无锡智慧市民中心电梯管理平台 -->
						{{ webTitle }}
						<span class="font23"></span>
						<!-- <span class="font12">Special Equipment Service Platform</span> -->
					</div>
				</div>
				<div class="header-right fr">
					<!-- v-if="role == 0" -->
					<el-badge :value="12132" class="cursor" v-if="false">
						<div class="el-icon-bell lingdang" style="font-size:31px;"></div>
					</el-badge>
					<el-dropdown @command="operation">
						<div class="el-icon-user userIcon cursor trans" style="font-size:31px;"></div>
						<el-dropdown-menu slot="dropdown">
							<el-dropdown-item command="a">{{ companyMess }}</el-dropdown-item>
							<el-dropdown-item command="b">修改密码</el-dropdown-item>
							<el-dropdown-item command="c">退出登录</el-dropdown-item>
						</el-dropdown-menu>
					</el-dropdown>
				</div>
				<!-- v-if="role == 0" -->
				<div class="fr liftMess bounceInRight" v-if="role == 0">
					<div>
						<span class="liftCount">电梯总数 {{ liftCount }}</span>
					</div>
					<div>
						<span class="jieruCount">接入单位 {{ jieruCount }}</span>
					</div>
					<div style="margin-right: 20px;">
						<span class="todayCount">接入外设 {{ guzhangCount }} </span>
					</div>
				</div>
			</el-header>
			<el-container>
				<el-aside style="width: 200px;height: 100%;">
					<vueScroll>
						<!-- $route.path -->
						<el-menu :unique-opened="true" router :default-active="activeIndex" class="el-menu-vertical-demo" @open="handleOpen"
						 @close="handleClose" background-color="#fff" text-color="#303133" active-text-color="#409EFF">
							<el-menu-item style="text-align: left;" v-if="show1" index="/MainView/Summarize" @click="addTag('平台概况', '/MainView/Summarize')"><i
								 class="iconfont icongaishu"></i>平台概况</el-menu-item>
							<div>
								<el-submenu index="1" v-if="show2">
									<template slot="title">
										<i class="iconfont iconjianshi"></i>
										<span>电梯实时监控</span>
									</template>
									<el-menu-item v-if="show2_1" index="/MainView/RealTimeElevatorMonitoring/OperationMonitoring" @click="
                      addTag(
                        '运行实时监控',
                        '/MainView/RealTimeElevatorMonitoring/OperationMonitoring'
                      )
                    "><i
										 class="iconfont iconjiankong2"></i>运行实时监控</el-menu-item>
									<!-- <el-menu-item v-if="show2_2" index="/MainView/RealTimeElevatorMonitoring/HowTheElevator" @click="addTag('多梯巡视监视','/MainView/RealTimeElevatorMonitoring/HowTheElevator')"><i
										 class="iconfont iconzhuangtai3"></i>多梯巡视监视</el-menu-item> -->
								</el-submenu>
								<el-submenu index="2" v-if="show3">
									<template slot="title">
										<i class="iconfont iconguzhang"></i>
										<span>电梯预警及故障即报</span>
									</template>
									<el-menu-item v-if="show3_1" index="/MainView/ElevatorFaultManagement/ElevatorFaultRecord" @click="
                      addTag(
                        '电梯故障记录',
                        '/MainView/ElevatorFaultManagement/ElevatorFaultRecord'
                      )
                    "><i
										 class="iconfont iconguzhangguanli"></i>电梯故障记录</el-menu-item>
									<!-- <el-menu-item  v-if="show3_2" index="/MainView/ElevatorFaultManagement/MalfunctionAnalysis" @click="addTag('电梯故障分析','/MainView/ElevatorFaultManagement/MalfunctionAnalysis')"><i
										 class="iconfont iconziyuantongji"></i>电梯故障分析</el-menu-item> -->
									<!-- <el-menu-item v-if="show3_2" index="/MainView/ElevatorFaultManagement/ElevatorFaultRecordStatis" @click="addTag('电梯故障数统计','/MainView/ElevatorFaultManagement/ElevatorFaultRecordStatis')"><i
										 class="iconfont iconziyuantongji"></i>电梯故障数统计</el-menu-item>
									<el-menu-item v-if="show3_3" index="/MainView/ElevatorFaultManagement/SiteUseTrouble" @click="addTag('使用地点故障数统计','/MainView/ElevatorFaultManagement/SiteUseTrouble')"><i
										 class="iconfont iconys_tongjifenxi"></i>使用地点故障数统计</el-menu-item> -->
								</el-submenu>
							</div>
							<el-submenu index="3" v-if="show4">
								<template slot="title">
									<i class="iconfont iconStatistics"></i>
									<span>电梯数据统计</span>
								</template>
								<el-menu-item v-if="show4_1" index="/MainView/ElevatorFaultManagement/MalfunctionAnalysis" @click="
                    addTag(
                      '电梯故障分析',
                      '/MainView/ElevatorFaultManagement/MalfunctionAnalysis'
                    )
                  "><i
									 class="iconfont iconziyuantongji"></i>电梯故障分析</el-menu-item>
								<el-menu-item v-if="show4_2" index="/MainView/ElevatorStatistics/LiftPhysical" @click="
                    addTag(
                      '电梯体检分析',
                      '/MainView/ElevatorStatistics/LiftPhysical'
                    )
                  "><i
									 class="iconfont icontongjibiaodan"></i>电梯体检分析</el-menu-item>
								<!-- <el-menu-item v-if="show4_1" index="/MainView/ElevatorStatistics/LiftStat" @click="addTag('电梯统计','/MainView/ElevatorStatistics/LiftStat')"><i
									 class="iconfont icontongjibaobiao"></i>电梯统计</el-menu-item>
								<el-menu-item v-if="show4_2" index="/MainView/ElevatorStatistics/LiftDistribute" @click="addTag('电梯分布统计','/MainView/ElevatorStatistics/LiftDistribute')"><i
									 class="iconfont icontongji4"></i>电梯分布统计</el-menu-item> -->
								<!-- 	<el-menu-item v-if="show4_3" index="/MainView/ElevatorStatistics/LiftSummarize" @click="addTag('电梯概况统计','/MainView/ElevatorStatistics/LiftSummarize')"><i
									 class="iconfont icontongji"></i>电梯概况统计</el-menu-item>
								<el-menu-item v-if="show4_4" index="/MainView/ElevatorStatistics/LiftBuildingUser" @click="addTag('电梯使用单位统计','/MainView/ElevatorStatistics/LiftBuildingUser')"><i
									 class="iconfont icontongji1"></i>电梯使用单位统计</el-menu-item>
								<el-menu-item v-if="show4_5" index="/MainView/ElevatorStatistics/LiftMaintenanceUnit" @click="addTag('电梯维保单位统计','/MainView/ElevatorStatistics/LiftMaintenanceUnit')"><i
									 class="iconfont iconzichantongji"></i>电梯维保单位统计</el-menu-item>
								<el-menu-item v-if="show4_6" index="/MainView/ElevatorStatistics/LiftBrand" @click="addTag('电梯品牌统计','/MainView/ElevatorStatistics/LiftBrand')"><i
									 class="iconfont iconpinpai"></i>电梯品牌统计</el-menu-item> -->
								<!-- 	<el-menu-item v-if="show4_7" index="/MainView/ElevatorStatistics/LiftMainState" @click="addTag('电梯维保状态统计','/MainView/ElevatorStatistics/LiftMainState')"><i
									 class="iconfont iconweibao"></i>电梯维保状态统计</el-menu-item>
								<el-menu-item v-if="show4_8" index="/MainView/ElevatorStatistics/LiftOperation" @click="addTag('电梯运行状态统计','/MainView/ElevatorStatistics/LiftOperation')"><i
									 class="iconfont iconzhuangtai2"></i>电梯运行状态统计</el-menu-item>
								<el-menu-item v-if="show4_9" index="/MainView/ElevatorStatistics/LiftSerState" @click="addTag('电梯维修状态统计','/MainView/ElevatorStatistics/LiftSerState')"><i
									 class="iconfont iconweixiu1"></i>电梯维修状态统计</el-menu-item>
								<el-menu-item v-if="show4_10" index="/MainView/ElevatorStatistics/LiftEmergency" @click="addTag('电梯应急救援状态统计','/MainView/ElevatorStatistics/LiftEmergency')"><i
									 class="iconfont icontongjibiaodan"></i>电梯应急救援状态统计</el-menu-item> -->
							</el-submenu>
							<el-submenu index="4" v-if="show5">
								<template slot="title">
									<i class="iconfont iconcheliangbaoyangjihua"></i>
									<span>电梯保养</span>
								</template>
								<el-menu-item v-if="show5_1" index="/MainView/OldStatistics" @click="addTag('维保概况', '/MainView/OldStatistics')">
									<i class="iconfont icontongji2"></i>维保概况
								</el-menu-item>
								<el-menu-item v-if="show5_2" index="/MainView/ElevatorMaintenance/MainPlan" @click="
                    addTag('保养计划', '/MainView/ElevatorMaintenance/MainPlan')
                  "><i
									 class="iconfont iconjihua"></i>保养计划</el-menu-item>
								<el-menu-item v-if="show5_3" index="/MainView/ElevatorMaintenance/MainPact" @click="
                    addTag('维保合同', '/MainView/ElevatorMaintenance/MainPact')
                  "><i
									 class="iconfont iconhetong"></i>维保合同</el-menu-item>
								<!-- <el-menu-item index="/MainView/ElevatorMaintenance/LiftManage" @click="addTag('电梯管理','/MainView/ElevatorMaintenance/LiftManage')"><i
									 class="iconfont iconguzhangguanli"></i>电梯管理</el-menu-item> -->
								<el-menu-item v-if="show5_4" index="/MainView/ElevatorMaintenance/LiftBound" @click="
                    addTag(
                      '电梯绑定',
                      '/MainView/ElevatorMaintenance/LiftBound'
                    )
                  "><i
									 class="iconfont iconbangding"></i>电梯绑定</el-menu-item>
								<el-menu-item v-if="show5_5" index="/MainView/ElevatorMaintenance/MainHistory" @click="
                    addTag(
                      '维保历史',
                      '/MainView/ElevatorMaintenance/MainHistory'
                    )
                  "><i
									 class="iconfont iconlishi"></i>维保历史</el-menu-item>
								<el-menu-item v-if="false" index="/MainView/ElevatorMaintenance/MainTenance" @click="
                    addTag(
                      '维保单位管理',
                      '/MainView/ElevatorMaintenance/MainTenance'
                    )
                  "><i
									 class="iconfont iconzuoyedanwei"></i>维保单位管理</el-menu-item>
								<el-menu-item v-if="false" index="/MainView/ElevatorMaintenance/MainEmploy" @click="
                    addTag(
                      '使用单位管理',
                      '/MainView/ElevatorMaintenance/MainEmploy'
                    )
                  "><i
									 class="iconfont iconwanglaidanwei"></i>使用单位管理</el-menu-item>
								<el-menu-item v-if="false" index="/MainView/ElevatorMaintenance/MainPerson" @click="
                    addTag(
                      '维保人员',
                      '/MainView/ElevatorMaintenance/MainPerson'
                    )
                  "><i
									 class="iconfont iconrenyuan"></i>维保人员</el-menu-item>
							</el-submenu>
							<el-submenu index="5" v-if="show6">
								<template slot="title">
									<i class="iconfont iconweixiu"></i>
									<span>维修管理</span>
								</template>
								<!-- 	<el-menu-item v-if="show6_2" index="/MainView/MaintenanceAndRepair/LiftInternetSer" @click="addTag('物联网报警','/MainView/MaintenanceAndRepair/LiftInternetSer')"><i
									 class="iconfont iconweixiuguanli"></i>物联网报警</el-menu-item> -->
								<el-menu-item v-if="show6_2" index="/MainView/MaintenanceAndRepair/LiftService" @click="
                    addTag(
                      '普通维修',
                      '/MainView/MaintenanceAndRepair/LiftService'
                    )
                  "><i
									 class="iconfont iconweixiu1"></i>普通维修</el-menu-item>
								<el-menu-item v-if="show6_3" index="/MainView/MaintenanceAndRepair/FittingsManagement" @click="
                    addTag(
                      '配件管理',
                      '/MainView/MaintenanceAndRepair/FittingsManagement'
                    )
                  "><i
									 class="iconfont iconweixiuguanli"></i>配件管理</el-menu-item>
							</el-submenu>
							<el-menu-item style="text-align: left;" v-if="role == 0" index="/MainView/RescueComfort" @click="addTag('电梯应急救援安抚', '/MainView/RescueComfort')"><i
								 class="iconfont iconzhanghuxinxi"></i>电梯应急救援安抚</el-menu-item>
							<el-submenu index="6" v-if="role == 0">
								<template slot="title">
									<i class="iconfont iconicon_xinyong_xianxing_jijin-"></i>
									<span>电梯信息发布管理</span>
								</template>
								<el-menu-item style="text-align: left;" index="/MainView/ReleaseManagement/ResourceAdmin" @click="addTag('资源管理', '/MainView/ReleaseManagement/ResourceAdmin')"><i
									 class="iconfont iconziyuanguanli"></i>资源管理</el-menu-item>
								<el-menu-item style="text-align: left;" index="/MainView/ReleaseManagement/BroadcastManage" @click="addTag('播放管理', '/MainView/ReleaseManagement/BroadcastManage')"><i
									 class="iconfont iconbofang"></i>播放管理</el-menu-item>
							</el-submenu>
							<el-submenu index="7" v-if="show9">
								<template slot="title">
									<i class="iconfont iconzichantongji"></i>
									<span>故障会诊及分析</span>
								</template>
								<el-menu-item v-if="show9_1" index="/MainView/ConsultationAndAnalysis" @click="
                    addTag('故障知识库', '/MainView/ConsultationAndAnalysis')
                  "><i
									 class="iconfont iconpinpai"></i>故障知识库</el-menu-item>
							</el-submenu>
							<el-submenu index="8" v-if="show10">
								<template slot="title">
									<i class="iconfont iconyewuchaxun"></i>
									<span>业务配置管理</span>
								</template>
								<el-menu-item v-if="show10_1" index="/MainView/ElevatorMaintenance/LiftManage" @click="
                    addTag(
                      '电梯管理',
                      '/MainView/ElevatorMaintenance/LiftManage'
                    )
                  "><i
									 class="iconfont iconguzhangguanli"></i>电梯管理</el-menu-item>
								<el-menu-item v-if="show10_2" index="/MainView/BusinessConfiguration/MaintenanceProjectMan" @click="
                    addTag(
                      '维修项目管理',
                      '/MainView/BusinessConfiguration/MaintenanceProjectMan'
                    )
                  "><i
									 class="iconfont iconxiangmuku"></i>维修项目管理</el-menu-item>
								<el-menu-item v-if="show10_3" index="/MainView/BusinessConfiguration/PeripheralsMan" @click="
                    addTag(
                      '外设管理',
                      '/MainView/BusinessConfiguration/PeripheralsMan'
                    )
                  "><i
									 class="iconfont iconguanligenjin"></i>外设管理</el-menu-item>
								<el-menu-item v-if="show10_4" index="/MainView/BusinessConfiguration/ManufactureCompany" @click="
                    addTag(
                      '制造单位管理',
                      '/MainView/BusinessConfiguration/ManufactureCompany'
                    )
                  "><i
									 class="iconfont iconicon-test"></i>制造单位管理</el-menu-item>
								<el-menu-item v-if="show10_5" index="/MainView/BusinessConfiguration/AccessManufacturer" @click="
                    addTag(
                      '平台接入控制',
                      '/MainView/BusinessConfiguration/AccessManufacturer'
                    )
                  "><i
									 class="iconfont iconshujujiaoti"></i>平台接入控制</el-menu-item>
							</el-submenu>
							<el-submenu index="9" v-if="show11">
								<template slot="title">
									<i class="iconfont iconguanli"></i>
									<span>系统管理</span>
								</template>
								<!-- 	<el-menu-item  index="/MainView/SystemManagement/TenanceAccount" @click="addTag('维保单位账户','/MainView/SystemManagement/TenanceAccount')"><i
									 class="iconfont iconzhanghuziliao"></i>维保单位账户</el-menu-item>
								<el-menu-item index="/MainView/SystemManagement/EmployAccount" @click="addTag('使用单位账户','/MainView/SystemManagement/EmployAccount')"><i
									 class="iconfont iconzhanghuxinxi"></i>使用单位账户</el-menu-item> -->
								<el-menu-item v-if="show11_1" index="/MainView/SystemManagement/RoleManagement" @click="
                    addTag(
                      '角色管理',
                      '/MainView/SystemManagement/RoleManagement'
                    )
                  "><i
									 class="iconfont iconrenyuan1"></i>角色管理</el-menu-item>
								<el-menu-item v-if="show11_2" index="/MainView/SystemManagement/UserCountManage" @click="
                    addTag(
                      '用户管理',
                      '/MainView/SystemManagement/UserCountManage'
                    )
                  "><i
									 class="iconfont iconyonghu"></i>用户管理</el-menu-item>
								<el-menu-item v-if="show11_3" index="/MainView/SystemManagement/InstitutionalFramework" @click="
                    addTag(
                      '单位管理',
                      '/MainView/SystemManagement/InstitutionalFramework'
                    )
                  "><i
									 class="iconfont iconuntitled85"></i>单位管理</el-menu-item>
								<el-menu-item v-if="show11_4" index="/MainView/SystemManagement/LiftLog" @click="addTag('日志', '/MainView/SystemManagement/LiftLog')"><i
									 class="iconfont icon022tongjifenxi"></i>日志</el-menu-item>
							</el-submenu>
						</el-menu>
					</vueScroll>
				</el-aside>
				<el-main>
					<div class="mainHeader">
						<div class="tags" ref="tagBox">
							<div ref="goTags" class="tabsBox" :style="{ left: tabsLeftNew + 'px' }">
								<el-tag class="cursor tagSitem" v-for="(item, index) in list" :key="item.label" closable effect="plain" @close="handleTagClose(item, index)"
								 @click="checkTag(item, index)">
									<i :class="[item.isColor ? 'iBlue' : 'iBlueInfo']"></i><span>{{ item.label }}</span>
								</el-tag>
							</div>
						</div>
						<div class="moveTags">
							<div class="el-icon-arrow-left cursor brandColor trans" @click="goScrollLeft"></div>
							<div class="el-icon-arrow-right cursor brandColor trans" @click="goScrollRight"></div>
							<el-dropdown @command="controlPro">
								<div class="el-icon-close  cursor brandColor trans"></div>
								<el-dropdown-menu slot="dropdown">
									<el-dropdown-item command="a">关闭其他</el-dropdown-item>
									<el-dropdown-item command="b">关闭所有</el-dropdown-item>
								</el-dropdown-menu>
							</el-dropdown>
						</div>
					</div>
					<div class="mainContent">
						<!-- include 只有匹配的才会缓存   
						*    exclude 任何匹配到的都不会缓存  -->
						<keep-alive>
							<router-view v-if="$route.meta.keepAlive"></router-view>
						</keep-alive>
						<router-view v-if="!$route.meta.keepAlive"></router-view>
					</div>
				</el-main>
			</el-container>
		</el-container>
		<transition name="el-fade-in">
			<!-- <mainTenance v-if='addAndCompileShow' :isAddOrComp='isAddOrComp' :addAndCompileShow='addAndCompileShow'
			 @detailMaskShow='detailMaskShow' :rowId='rowId'></mainTenance> -->
			<el-dialog :close-on-click-modal="false" :append-to-body="true" :before-close="close" :close-on-press-escape="false"
			 title="单位信息" :visible.sync="addAndCompileShow" v-if="addAndCompileShow">
				<mainTenance :nowStatus="1" :btnLocation="false" @closeMessage="close"></mainTenance>
			</el-dialog>
		</transition>

		<el-dialog custom-class="changePwd" :visible.sync="changePwd" title="修改密码" :append-to-body="true" :before-close="closeChangePwd">
			<el-form :model="form" :rules="rules" ref="form">
				<el-row>
					<el-col :span="15" :offset="1">
						<el-form-item label="旧密码:" :label-width="formLabelWidth" prop="oldPass">
							<el-input size="mini" type="password" v-model.trim="form.oldPass" autocomplete="off" clearable></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="15" :offset="1">
						<el-form-item label="新密码:" :label-width="formLabelWidth" prop="pass">
							<el-input size="mini" type="password" v-model.trim="form.pass" autocomplete="off" clearable></el-input>
						</el-form-item>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="15" :offset="1">
						<el-form-item label="确认密码:" :label-width="formLabelWidth" prop="checkPass">
							<el-input size="mini" type="password" v-model.trim="form.checkPass" autocomplete="off" clearable></el-input>
						</el-form-item>
					</el-col>
				</el-row>
			</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button @click="closeChangePwd">取 消</el-button>
				<el-button type="primary" @click="submitPwd('form')" v-loading="ensureBtn">确 定</el-button>
			</div>
		</el-dialog>
	</div>
</template>

<script>
	import {
		axiosPost,
		axiosGet,
		loadFn,
		axiosChange,
		removeAllStorage,
		AllLoading
	} from "@/common.js";
	import {
		oldPass,
		pass
	} from "@/components/ElevatorMaintenance/MainPerson/rule.js";
	// import mainTenance from "@/components/ElevatorMaintenance/MainTenance/addAndCompile"
	import mainTenance from "@/components/SystemManagement/AddInstitutionalFramework/index.vue";
	import $ from "jquery";
	export default {
		components: {
			mainTenance
		},
		mounted() {
			this.getTimeLoop()
			if (localStorage.newTitle) {
				document.title = JSON.parse(localStorage.newTitle).name
			}
			if (localStorage.logoUrl) {
				this.imgLeft = JSON.parse(localStorage.logoUrl).url
			}
			if (localStorage.logoUrlIco) {
				let url = JSON.parse(localStorage.logoUrlIco).url
				document.getElementById('icon').setAttribute('href', url)
			}

			this.$store.commit("TABLISTCHANGE");
			if (localStorage.menuActive) {
				this.activeIndex = JSON.parse(localStorage.menuActive).active;
			}
			this.isShowTab();
		},
		data() {
			var validatePass2 = (rule, value, callback) => {
				if (value === "") {
					callback(new Error("请再次输入密码"));
				} else if (value !== this.form.pass) {
					callback(new Error("两次输入密码不一致!"));
				} else {
					callback();
				}
			};
			return {
				show1: false,
				show2: false,
				show3: false,
				show4: false,
				show5: false,
				show6: false,
				show7: false,
				show8: false,
				show9: false,
				show10: false,
				show11: false,
				show2_1: false,
				show2_2: false,
				show3_1: false,
				show3_2: false,
				show3_3: false,
				show4_1: false,
				show4_2: false,
				show4_3: false,
				show4_4: false,
				show4_5: false,
				show4_6: false,
				show4_7: false,
				show4_8: false,
				show4_9: false,
				show4_10: false,
				show5_1: false,
				show5_2: false,
				show5_3: false,
				show5_4: false,
				show5_5: false,
				show6_2: false,
				show6_3: false,
				show9_1: false,
				show10_1: false,
				show10_2: false,
				show10_3: false,
				show10_4: false,
				show10_5: false,
				show11_1: false,
				show11_2: false,
				show11_3: false,
				show11_4: false,
				show11_5: false,
				show11_6: false,
				activeIndex: "",
				addAndCompileShow: false,
				isAddOrComp: "",
				rowId: localStorage.company_id ?
					JSON.parse(localStorage.company_id).id : "",
				formLabelWidth: "120px",
				// tabsLeft: localStorage.tabsLeft ? JSON.parse(localStorage.tabsLeft).left : 0,
				changePwd: false,
				form: {
					oldPass: "",
					pass: "",
					checkPass: ""
				},
				rules: {
					oldPass,
					pass,
					checkPass: [{
						required: true,
						validator: validatePass2,
						trigger: "blur"
					}]
				},
				ensureBtn: false,
				// require('../assets/loginImg/LiftLogo.jpg')
				imgLeft: '',
				currentListArr: []
			};
		},
		computed: {
			webTitle() {
				if (localStorage.web) {
					return JSON.parse(localStorage.web).title;
				} else {
					return "";
				}
			},
			liftCount() {
				if (localStorage.all_elevator_count) {
					return JSON.parse(localStorage.all_elevator_count).count;
				} else {
					return 0;
				}
			},
			jieruCount() {
				if (localStorage.all_access_count) {
					return JSON.parse(localStorage.all_access_count).count;
				} else {
					return 0;
				}
			},
			guzhangCount() {
				if (localStorage.all_today_fault) {
					return JSON.parse(localStorage.all_today_fault).count;
				} else {
					return 0;
				}
			},
			//权限数据
			ptList() {
				if (localStorage.pt) {
					return JSON.parse(localStorage.pt).list;
				} else {
					return [];
				}
			},
			// 0 超管 10 维保人员 20 维保单位 30 使用单位 40 监管单位
			tabsLeftNew() {
				return this.$store.state.tabsLeft;
			},
			list() {
				return this.$store.state.tabList;
			},
			role() {
				if (localStorage.role) {
					return JSON.parse(localStorage.role).id;
				} else {
					return "";
				}
			},
			companyMess() {
				if (localStorage.username) {
					return JSON.parse(localStorage.username).name;
				} else {
					return "";
				}
			},
			roleId() {
				if (localStorage.roleId) {
					console.log(JSON.parse(localStorage.roleId).id);
					return JSON.parse(localStorage.roleId).id;
				} else {
					return "";
				}
			},
			username() {
				if (localStorage.username) {
					return JSON.parse(localStorage.username).name;
				} else {
					return "";
				}
			}
		},
		methods: {
			getTimeLoop() {
				let flag = true
				const timer = setInterval(() => {
					if (flag) {
						axiosGet('/manu/elevator/alarms/rotation/', '', (res) => {
							flag = false
							if (res.code == 0) {
								this.currentListArr = res.detail
								let length = this.currentListArr.length
								// console.log(length)
								if (length != 0) {
									let num = 0
									let time = setInterval(() => {
										num++
										this.$notify({
											title: '',
											dangerouslyUseHTMLString: true,
											message: `<div class='messTitle'>${this.currentListArr[num-1] }</div><div class='messTitle colorS'>有待处理的事项</div>`,
											position: 'bottom-right',
											type: 'info'
										});
										console.log(num)
										if (num == length) {
											clearInterval(time)
											flag = true
										}
									}, 3000)
								} else {
									flag = true
								}
							}
						})
					}
				}, 2000)
				this.$once('hook:beforeDestroy', () => {
					clearInterval(timer);
				})
			},
			close() {
				this.addAndCompileShow = false;
			},
			//显示公共函数
			publicShowTab(value) {
				return this.ptList.some(item => {
					return item.index == value;
				});
			},
			publicShowTabItem(currentIndex, value) {
				let isShow = this.ptList[currentIndex].pids.some(item => {
					return item.index === value;
				});
				return isShow;
			},
			//判断显示	8个tab
			isShowTab() {
				let index1 = "";
				let index11 = "";
				let index2 = "";
				let index22 = "";
				let index3 = "";
				let index33 = "";
				let index4 = "";
				let index44 = "";
				let index5 = "";
				let index55 = "";
				let index6 = "";
				let index66 = "";
				let index9 = "";
				let index99 = "";
				let index10 = "";
				let index1010 = "";
				let index_11 = "";
				let index1111 = "";
				this.ptList.map((item, index) => {
					if (item.name == "平台概述") {
						index1 = item.index;
						index11 = index;
					}
					if (item.name == "电梯实时监控") {
						index2 = item.index;
						index22 = index;
					}
					if (item.name == "电梯故障管理") {
						index3 = item.index;
						index33 = index;
					}
					if (item.name == "电梯数据统计") {
						index4 = item.index;
						index44 = index;
					}
					if (item.name == "电梯保养") {
						index5 = item.index;
						index55 = index;
					}
					if (item.name == "维修管理") {
						index6 = item.index;
						index66 = index;
					}
					if (item.name == "故障会诊及分析") {
						index9 = item.index;
						index99 = index;
					}
					if (item.name == "业务配置管理") {
						index10 = item.index;
						index1010 = index;
					}
					if (item.name == "系统管理") {
						index_11 = item.index;
						index1111 = index;
					}
				});

				if (index1) {
					this.show1 = this.publicShowTab(index1);
				}
				if (index2) {
					this.show2 = this.publicShowTab(index2);
					this.show2_1 = this.publicShowTabItem(index22, "2-1");
					this.show2_2 = this.publicShowTabItem(index22, "2-2");
					localStorage.jianKong = JSON.stringify({
						list: this.ptList[index22].pids
					});
				}
				if (index3) {
					this.show3 = this.publicShowTab(index3);
					this.show3_1 = this.publicShowTabItem(index33, "3-1");
					this.show3_2 = this.publicShowTabItem(index33, "3-2");
					this.show3_3 = this.publicShowTabItem(index33, "3-3");
					localStorage.guZhang = JSON.stringify({
						list: this.ptList[index33].pids
					});
				}
				if (index4) {
					this.show4 = this.publicShowTab(index4);
					this.show4_1 = this.publicShowTabItem(index44, "4-1");
					this.show4_2 = this.publicShowTabItem(index44, "4-2");
					this.show4_3 = this.publicShowTabItem(index44, "4-3");
					this.show4_4 = this.publicShowTabItem(index44, "4-4");
					this.show4_5 = this.publicShowTabItem(index44, "4-5");
					this.show4_6 = this.publicShowTabItem(index44, "4-6");
					this.show4_7 = this.publicShowTabItem(index44, "4-7");
					this.show4_8 = this.publicShowTabItem(index44, "4-8");
					this.show4_9 = this.publicShowTabItem(index44, "4-9");
					this.show4_10 = this.publicShowTabItem(index44, "4-10");
					localStorage.tongJi = JSON.stringify({
						list: this.ptList[index44].pids
					});
				}
				if (index5) {
					this.show5 = this.publicShowTab(index5);
					this.show5_1 = this.publicShowTabItem(index55, "5-1");
					this.show5_2 = this.publicShowTabItem(index55, "5-2");
					this.show5_3 = this.publicShowTabItem(index55, "5-3");
					this.show5_4 = this.publicShowTabItem(index55, "5-4");
					this.show5_5 = this.publicShowTabItem(index55, "5-5");
					localStorage.baoYang = JSON.stringify({
						list: this.ptList[index55].pids
					});
				}
				if (index6) {
					this.show6 = this.publicShowTab(index6);
					this.show6_2 = this.publicShowTabItem(index66, "6-2");
					this.show6_3 = this.publicShowTabItem(index66, "6-3");
					localStorage.weiXiu = JSON.stringify({
						list: this.ptList[index66].pids
					});
				}
				if (index9) {
					this.show9 = this.publicShowTab(index9);
					this.show9_1 = this.publicShowTabItem(index99, "9-1");
					localStorage.huizhan = JSON.stringify({
						list: this.ptList[index99].pids
					});
				}
				if (index10) {
					this.show10 = this.publicShowTab(index10);
					this.show10_1 = this.publicShowTabItem(index1010, "10-1");
					this.show10_2 = this.publicShowTabItem(index1010, "10-2");
					this.show10_3 = this.publicShowTabItem(index1010, "10-3");
					this.show10_4 = this.publicShowTabItem(index1010, "10-4");
					this.show10_5 = this.publicShowTabItem(index1010, "10-5");
					localStorage.yeWu = JSON.stringify({
						list: this.ptList[index1010].pids
					});
				}
				if (index_11) {
					this.show11 = this.publicShowTab(index_11);
					this.show11_1 = this.publicShowTabItem(index1111, "11-1");
					this.show11_2 = this.publicShowTabItem(index1111, "11-2");
					this.show11_3 = this.publicShowTabItem(index1111, "11-3");
					this.show11_4 = this.publicShowTabItem(index1111, "11-4");
					this.show11_5 = this.publicShowTabItem(index1111, "11-5");
					this.show11_6 = this.publicShowTabItem(index1111, "11-6");
					localStorage.xiTong = JSON.stringify({
						list: this.ptList[index1111].pids
					});
				}
			},
			//关闭修改密码
			closeChangePwd() {
				this.changePwd = false;
			},
			//提交修改密码
			submitPwd(ruleForm) {
				this.$refs[ruleForm].validate(valid => {
					if (valid) {
						this.ensureBtn = true;
						let id = this.roleId;
						let url = "/user/auth/" + id + "/";
						let data = {
							username: this.username,
							old_pwd: this.form.oldPass,
							pwd: this.form.pass
						};
						axiosChange(url, "put", data, res => {
							this.ensureBtn = false;
							if (res.code == 0) {
								this.$message({
									type: "success",
									message: "修改成功!"
								});
								this.closeChangePwd();
								removeAllStorage();
								this.$router.push({
									name: "Login"
								});
							} else {
								this.$message.error(res.detail.result);
							}
						});
					} else {
						console.log("error submit!!");
						return false;
					}
				});
			},
			//点击向左箭头
			goScrollLeft() {
				if (this.$store.state.tabsLeft != 0) {
					if (this.$store.state.tabsLeft + 180 >= 0) {
						this.$store.state.tabsLeft = 0;
					} else {
						this.$store.state.tabsLeft += 180;
					}
					localStorage.tabsLeft = JSON.stringify({
						left: this.$store.state.tabsLeft
					});
				}
			},
			//点击向右箭头
			goScrollRight() {
				let dom = this.$refs.goTags;
				let outBox = this.$refs.tagBox;
				let domWidth = dom.offsetWidth;
				let outBoxWidth = outBox.offsetWidth;
				let maxWidth = Math.abs(outBoxWidth - domWidth);
				if (domWidth >= outBoxWidth) {
					if (maxWidth > Math.abs(this.$store.state.tabsLeft)) {
						this.$store.state.tabsLeft -= 180;
						localStorage.tabsLeft = JSON.stringify({
							left: this.$store.state.tabsLeft
						});
					}
				}
			},
			//关闭维保公司信息弹窗
			detailMaskShow(isShow) {
				this.addAndCompileShow = false;
			},
			//添加打开弹窗
			operation(value) {
				if (value == "a") {
					if (this.companyMess != "admin") {
						if (localStorage.company_id) {
							localStorage.frameworkId = JSON.stringify({
								id: JSON.parse(localStorage.company_id).id
							});
							this.addAndCompileShow = true;
						}
					}
				} else if (value == "b") {
					this.changePwd = true;
				} else if (value == "c") {
					this.$confirm("此操作将退出登录, 是否继续?", "提示", {
							confirmButtonText: "确定",
							cancelButtonText: "取消",
							type: "warning"
						})
						.then(() => {
							loadFn();
							axiosPost("/user/logout/", {}, res => {
								AllLoading.close();
								if (res.code == 0) {
									removeAllStorage();
									this.$store.state.tabsLeft = 0;
									this.$message({
										type: "success",
										message: "登出成功!"
									});
									this.$router.push({
										name: "Login"
									});
								} else {
									this.$message.error(res.detail.result);
								}
							});
						})
						.catch(() => {});
				}
			},
			//关闭所有tab后跳转
			publickStatisLink() {
				this.clearLocal();
				this.$store.state.tabList = [{
					label: "平台概述",
					isColor: 1,
					pathIndex: "/MainView/Summarize"
				}];
				localStorage.menuActive = JSON.stringify({
					active: "/MainView/Summarize"
				});
				localStorage.tags = JSON.stringify({
					list: this.$store.state.tabList
				});
				this.$router.push({
					name: "Summarize"
				});
			},
			//tabs 关闭
			controlPro(value) {
				if (value == "a") {
					this.$store.state.tabList = this.$store.state.tabList.filter(item => {
						return item.isColor == 1;
					});
					localStorage.tags = JSON.stringify({
						list: this.$store.state.tabList
					});
					localStorage.menuActive = JSON.stringify({
						active: this.$store.state.tabList[0].pathIndex
					});
				} else {
					this.publickStatisLink();
				}
				this.$store.state.tabsLeft = 0;
				localStorage.tabsLeft = JSON.stringify({
					left: this.$store.state.tabsLeft
				});
			},
			handleOpen(key, keyPath) {
				console.log(key, keyPath);
			},
			handleClose(key, keyPath) {
				console.log(key, keyPath);
			},
			//添加本地缓存
			listAdd() {
				let list = this.$store.state.tabList;
				localStorage.tags = JSON.stringify({
					list: list
				});
			},
			//删除tag
			handleTagClose(tag, index) {
				this.clearLocal();
				if (tag.isColor == 1) {
					this.$store.state.tabList.map(item => {
						item.isColor = 0;
					});
					if (this.$store.state.tabList.length != 0) {
						if (index != 0) {
							this.$store.state.tabList[index - 1].isColor = 1;
							this.$router.push({
								path: this.$store.state.tabList[index - 1].pathIndex
							});
							localStorage.menuActive = JSON.stringify({
								active: this.$store.state.tabList[index - 1].pathIndex
							});
						} else {
							this.$store.state.tabList[
								this.$store.state.tabList.length - 1
							].isColor = 1;
							this.$router.push({
								path: this.$store.state.tabList[
									this.$store.state.tabList.length - 1
								].pathIndex
							});
							localStorage.menuActive = JSON.stringify({
								active: this.$store.state.tabList[
									this.$store.state.tabList.length - 1
								].pathIndex
							});
						}
					}
				}
				if (localStorage.tabsLeft) {
					this.$store.state.tabsLeft = JSON.parse(localStorage.tabsLeft).left;
				}
				if (this.$store.state.tabsLeft + 150 >= 0) {
					this.$store.state.tabsLeft = 0;
				} else {
					this.$store.state.tabsLeft = this.$store.state.tabsLeft + 150;
					console.log(this.$store.state.tabsLeft);
				}
				let leftNow = this.$store.state.tabsLeft;
				localStorage.tabsLeft = JSON.stringify({
					left: leftNow
				});
				this.$store.state.tabList.splice(
					this.$store.state.tabList.indexOf(tag),
					1
				);
				if (this.$store.state.tabList.length == 0) {
					this.publickStatisLink();
				}
				this.listAdd();
				this.$store.state.choseLiftData = [];
			},
			//清除缓存
			clearLocal() {
				localStorage.removeItem("choseLiftData");
			},
			//添加tag
			addTag(newLabel, index) {
				this.clearLocal();
				console.log(newLabel, index);
				let obj = {
					newLabel: newLabel,
					index: index
				};
				this.$store.commit("ADDTAB", obj);
			},
			//切换tag
			checkTag(tag) {
				this.clearLocal();
				console.log(tag);
				localStorage.menuActive = JSON.stringify({
					active: tag.pathIndex
				});
				let tagName = tag.label;
				this.$store.state.tabList.map(item => {
					if (item.label == tagName) {
						item.isColor = 1;
						this.$router.push({
							path: item.pathIndex
						});
					} else {
						item.isColor = 0;
					}
				});
				this.listAdd();
			}
		}
	};
</script>

<style lang="less">
	.main-box {
		height: 100%;

		.el-header {
			background-color: #032c4cf2;
			color: #333;
			text-align: center;
			padding: 10px;
			box-sizing: border-box;
			height: 60px;

			.header-left {
				display: flex;
				flex-direction: row;

				.titleDes {
					display: flex;
					flex-direction: column;
					justify-content: center;
					color: #fff;
					padding-left: 20px;
				}

				img {
					padding-left: 20px;
				}
			}

			.header-right {
				display: flex;
				align-items: center;
				height: 100%;
				padding-right: 25px;

				.lingdang,
				.userIcon {
					color: #fff;
					font-size: 28px;
				}

				.userIcon {
					padding-left: 28px;
					transition: all 1s linear;
				}
			}

			.liftMess {
				animation-duration: 1.5s;
				height: 100%;
				color: #fff;
				display: flex;
				flex-direction: row;
				align-items: center;
				font-size: 14px;

				div {
					margin: 10px;

					span {
						padding: 10px;
						box-sizing: border-box;
						padding: 7px 10px;
						border-radius: 5px;
					}
				}
			}
		}

		.el-aside {
			text-align: center;

			.el-menu {
				height: 100%;
			}
		}

		.el-main {
			color: #333;
			text-align: center;
			padding: 15px;
			overflow-y: hidden;
		}

		.el-container {
			height: 100%;
		}

		.mainHeader {
			width: 100%;
			background: #e9eef3;
			height: 40px;
			margin-bottom: 1%;
			display: flex;
			flex-direction: row;
			position: relative;
			border-radius: 5px;

			.tags {
				width: 90%;
				height: 100%;
				display: flex;
				flex-direction: row;
				justify-content: flex-start;
				align-items: center;
				overflow: hidden;
				position: relative;

				.el-tag {
					margin: 0 5px;
				}
			}

			.moveTags {
				width: 10%;
				height: 100%;
				display: flex;
				justify-content: space-around;
				align-items: center;

				.cursor {
					font-size: 20px;
				}
			}
		}

		.mainContent {
			width: 100%;
			height: 92%;
			background: #e9eef3;
			padding: 5px;
			box-sizing: border-box;
			box-sizing: border-box;
		}
	}

	.el-menu-item:hover,
	.el-submenu__title:hover {
		background: #e9eef3 !important;
	}

	.iBlue {
		display: inline-block;
		width: 10px;
		height: 10px;
		background: #2196f3;
		border-radius: 50%;
		margin-right: 10px;
	}

	.iBlueInfo {
		display: inline-block;
		width: 10px;
		height: 10px;
		background: #9e9e9e4a;
		border-radius: 50%;
		margin-right: 10px;
	}

	.liftCount {
		background: #36d4a8;
	}

	.jieruCount {
		background: #45cfe0;
	}

	.todayCount {
		background: #ef6b62;
	}

	.trans:hover {
		color: #409eff !important;
	}

	#goTags {
		position: relative;
	}

	.tabsBox {
		height: 100%;
		display: flex;
		align-items: center;
		position: relative;
		transition: all 0.5s linear;
		// width: 100%;
	}

	.el-menu {
		border: 0 none;
	}

	.iconfont {
		margin-right: 10px;
		font-size: 18px !important;
	}

	.messTitle {
		font-weight: 500;
		font-size: 17px;
	}

	.colorS {
		color: #008181;
		font-size: 16px;
		font-style: italic;
	}
</style>
